package sy9_2;

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class Demo {
    public static void main(String[] args) {
        byte[] buf={1,2,3,4,5};
        ByteArrayInputStream bais=null;
        bais = new ByteArrayInputStream(buf);
        int data = -1;
        while ((data=bais.read())!=-1){
            System.out.println(data);
        }
        try {
            bais.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
